package com.qidi.mapper.impl;

import com.qidi.mapper.OrderItemDao;
import com.qidi.pojo.OrderItem;

import java.util.List;

/**
 * @author zhouXinBin
 * @create 2020-09-04-12:28
 */
public class OrderItemimplDao extends BaseDao implements OrderItemDao {
    @Override
    public int saveOrderItem(com.qidi.pojo.OrderItem orderItem) {
        String sql="insert into t_order_item(name,count,price,total_price,order_id) values(?,?,?,?,?)";
        return update(sql,orderItem.getName(),orderItem.getCount(),orderItem.getPrice(),orderItem.getTotalPrice(),orderItem.getOrderId());

    }

    @Override
    public List<OrderItem> queryOrderItems(String orderid) {
        String sql="select id,name,count,price,total_price totalPrice,order_id orderId from t_order_item where order_id=?";
        return queryForList(OrderItem.class,sql,orderid);
    }
}
